package com.ruoyi.supply.domain;

import java.util.Date;
import java.util.Objects;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.baomidou.mybatisplus.annotation.*;
import com.ruoyi.common.utils.DateUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;

/**
 * 会员管理对象 t_member
 * 
 * @author Ryan
 * @date 2025-06-13
 */
@Data
@ApiModel("会员管理")
@EqualsAndHashCode(callSuper = true)
@TableName("t_member")
public class TMember extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** id */
    @TableId(type = IdType.ASSIGN_ID)
    @JsonFormat(shape = JsonFormat.Shape.STRING)
    @ApiModelProperty("id")
    private Long id;

    /** openid */
    @Excel(name = "openid")
    @ApiModelProperty("openid")
    private String openid;

    /** unionid */
    @Excel(name = "unionid")
    @ApiModelProperty("unionid")
    private String unionid;

    /** 手机号 */
    @Excel(name = "手机号")
    @ApiModelProperty("手机号")
    private String phone;

    /** 开通时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
    @Excel(name = "开通时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm")
    @ApiModelProperty("开通时间")
    private Date activationTime;

    /** 失效时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
    @Excel(name = "失效时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm")
    @ApiModelProperty("失效时间")
    private Date expirationTime;

    /** 状态;0激活1失效 */
    @Excel(name = "状态;0激活1失效")
    @ApiModelProperty("状态;0激活1失效")
    private String status;

    /** 用户名 */
    @Excel(name = "用户名")
    @ApiModelProperty("用户名")
    private String username;

    /** 头像 */
    @Excel(name = "头像")
    @ApiModelProperty("头像")
    private String avatar;

    /** 会员等级;0游客 1... 会员 */
    @Excel(name = "会员等级;0游客 1... 会员")
    @ApiModelProperty("会员等级;0游客 1... 会员")
    private String grade;

    /** 获取联系方式的次数 */
    @Excel(name = "获取联系方式的次数")
    @ApiModelProperty("获取联系方式的次数")
    private Long obtainContactNum;

    /** del falg;0存在，2删除 */
    @JsonIgnore
    @TableLogic(value = "0",delval = "2")
    @ApiModelProperty("del falg;0存在，2删除")
    private String delFlag;

    public String genExpirationTimeStr(){
        return Objects.isNull(expirationTime) ? null : DateUtils.parseDateToStr("yyyy-MM-dd HH:mm",expirationTime);
    }

}
